import request from '@/config/axios'

// ERP仓库管理-物料出库单主 VO
export interface StockMaterialOutboundVO {
  id: string // id
  outboundNo: string // 出库单号码
  user: string // 领用人
  outboundDate: Date // 领用日期
  audit: boolean // 审核
  auditor: string // 审核人
  auditTime: Date // 审核时间
  workshop: string // 车间
  remark: string // 备注
}

// ERP仓库管理-物料出库单主 API
export const StockMaterialOutboundApi = {
  // 查询ERP仓库管理-物料出库单主分页
  getStockMaterialOutboundPage: async (params: any) => {
    return await request.get({ url: `/erp/stock-material-outbound/page`, params })
  },

  // 查询ERP仓库管理-物料出库单主详情
  getStockMaterialOutbound: async (id: number) => {
    return await request.get({ url: `/erp/stock-material-outbound/get?id=` + id })
  },

  // 新增ERP仓库管理-物料出库单主
  createStockMaterialOutbound: async (data: StockMaterialOutboundVO) => {
    return await request.post({ url: `/erp/stock-material-outbound/create`, data })
  },

  // 修改ERP仓库管理-物料出库单主
  updateStockMaterialOutbound: async (data: StockMaterialOutboundVO) => {
    return await request.put({ url: `/erp/stock-material-outbound/update`, data })
  },

  // 删除ERP仓库管理-物料出库单主
  deleteStockMaterialOutbound: async (id: number) => {
    return await request.delete({ url: `/erp/stock-material-outbound/delete?id=` + id })
  },

  // 导出ERP仓库管理-物料出库单主 Excel
  exportStockMaterialOutbound: async (params) => {
    return await request.download({ url: `/erp/stock-material-outbound/export-excel`, params })
  },

// ==================== 子表（ERP仓库管理-物料出库单子表） ====================

  // 获得ERP仓库管理-物料出库单子表分页
  getMaterialOutboundDetailPage: async (params) => {
    return await request.get({ url: `/erp/stock-material-outbound/material-outbound-detail/page`, params })
  },
  // 新增ERP仓库管理-物料出库单子表
  createMaterialOutboundDetail: async (data) => {
    return await request.post({ url: `/erp/stock-material-outbound/material-outbound-detail/create`, data })
  },

  // 修改ERP仓库管理-物料出库单子表
  updateMaterialOutboundDetail: async (data) => {
    return await request.put({ url: `/erp/stock-material-outbound/material-outbound-detail/update`, data })
  },

  // 删除ERP仓库管理-物料出库单子表
  deleteMaterialOutboundDetail: async (id: number) => {
    return await request.delete({ url: `/erp/stock-material-outbound/material-outbound-detail/delete?id=` + id })
  },

  // 获得ERP仓库管理-物料出库单子表
  getMaterialOutboundDetail: async (id: number) => {
    return await request.get({ url: `/erp/stock-material-outbound/material-outbound-detail/get?id=` + id })
  }
}